﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.ComponentModel;
using System.Reflection;
using Scoreloop.CoreSocial.API;
using Scoreloop.CoreSocial.API.Model;
using System.Windows.Data;

namespace MemoBoss
{
    public partial class ScoreboardScreen : UserControl
    {
        Action returnMethod;
        Action SetBackgroundPicture;
        public ScoreboardScreen(Action callback, Action SetBGPicture)
        {
            SetBackgroundPicture = SetBGPicture;
            returnMethod = callback;
            InitializeComponent();

        }

        private void goBack()
        {
            Hide.Begin();
            returnMethod();
        }


        private void btnBack_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            goBack();
        }



        private void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
        {

        }
        ScoreViewModel easyModel = new ScoreViewModel();
        ScoreViewModel mediumModel = new ScoreViewModel();
        ScoreViewModel hardModel = new ScoreViewModel();
        ScoreViewModel memoBossModel = new ScoreViewModel();

        public void startLoad()
        {
            easyPivot.DataContext = easyModel;
            easyModel.Items.Clear();
            easyModel.LoadScoreBoard(DifficultyLevel.Easy);

            mediumPivot.DataContext = mediumModel;
            mediumModel.Items.Clear();
            mediumModel.LoadScoreBoard(DifficultyLevel.Medium);

            hardPivot.DataContext = hardModel;
            hardModel.Items.Clear();
            hardModel.LoadScoreBoard(DifficultyLevel.Hard);

            memoBossPivot.DataContext = memoBossModel;
            memoBossModel.Items.Clear();
            memoBossModel.LoadScoreBoard(DifficultyLevel.MemoBoss);
            pvtScoreboards.SelectedItem = easyPivot;
        }

        private void Show_Completed(object sender, EventArgs e)
        {
            SetBackgroundPicture();

          
            // this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        }
        public void ExitScreen()
        {
            this.Hide.Begin();

        }

    }
   
    
}
